import time
import cv2 as cv

video = cv.VideoCapture("../resources/miku.mp4") # VideoCapthre(0): 摄像头
f, frame = video.read()
w, h = video.get(cv.CAP_PROP_FRAME_WIDTH), video.get(cv.CAP_PROP_FRAME_HEIGHT)
fps = video.get(cv.CAP_PROP_FPS)

while f:
    cv.imshow("video", frame)
    if cv.waitKey(1) & 0xFF == ord('q'):
        break
    time.sleep(1 / fps)
    f, frame = video.read()
video.release()
cv.destroyAllWindows()